var _yutil = (function(){
	return {
		queryParam: function(jObj){
			if(jObj == null || jObj.length == 0){
				return {};
			}
			var res = {};
			jObj.each(function(i){
				//console.log(jObj[i]);
				let id = jQuery(jObj[i]).attr("id");
				let val = jQuery(jObj[i]).val();
				if(id)
					res[id] = val;
			});
			
			return res;
		},
		cleanParam: function(jObj){
			if(jObj == null || jObj.length == 0){
				return {};
			}
			jObj.each(function(i){
				//console.log(jObj[i]);
				let id = jQuery(jObj[i]).attr("id");
				if(id)
					jQuery(jObj[i]).val("");
			});
			
		}
		,commonCheck: function(jobj){
			var flag;
			if(!jobj || jobj.length == 0){
				return {
					code: 1,
					msg: ''
				};
			}
			
			jobj.each(function(i){
				var obj = jQuery(this);
				var val = obj.val();
				var desc = obj.attr("_desc");
				if(obj.hasClass("_check_not_null")){
					if(!val){
						if(desc)
							flag = "【" + desc + "】不可为空";
						else
							flag = "数据不可为空";
						return false;
					}
				}
				if(obj.hasClass("_check_pos_int")){
					var regPos = /^\d+$/; // 非负整数 
					if(!regPos.test(val)){
						if(desc)
							flag = "【" + desc + "】必须为整数";
						else
							flag = "必须为整数";
						return false;
					}
				}
			});
			
			return {
				code: flag ? 0 : 1,
				msg: flag
			};
		}
	};
})();
